class mytool:
    def __new__(cls, func, *args, **kwargs):
        print(cls, func, args, kwargs)
        if not callable(func):
            raise TypeError(f'{func} must be callable')

        if hasattr(func, 'func'):
            print('__qualname__', func.__qualname__)

        self = super(mytool, cls).__new__(cls)
        self.func = func
        self.args = args
        self.kwargs = kwargs
        return self

    def __init__(self, *args, **kwargs):
        print('__init__')

    def __call__(self, *args, **kwargs):
        # print(args, kwargs)
        self.func(*args, **kwargs)
        print('=======call=====')


def myfun(name='vincent'):
    print('myfun', name)
    pass


mytool(myfun)(name="aaaa")
